﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Microsoft.Practices.Prism.ViewModel;

namespace IntoNails.Infrastructure.ViewModels
{
    public abstract class AbstractViewModel : NotificationObject, IViewModel
    {
        public event EventHandler ViewCloseRequested = delegate { };

        private bool _isBusy;
        private string _busyContent;
        private int _percentCompleted;

        public bool IsBusy
        {
            get { return this._isBusy; }
            set
            {
                this._isBusy = value;
                base.RaisePropertyChanged(() => IsBusy);
            }
        }

        public string BusyContent
        {
            get { return this._busyContent; }
            set
            {
                this._busyContent = value;
                base.RaisePropertyChanged(() => BusyContent);
            }
        }

        public int PercentCompleted
        {
            get { return this._percentCompleted; }
            set
            {
                this._percentCompleted = value;
                base.RaisePropertyChanged(() => PercentCompleted);
            }
        }

        public virtual void Init()
        {
            this.RegisterCommands();
            this.RegisterEvents();
        }

        protected virtual void RegisterCommands()
        {
            
        }

        protected virtual void RegisterEvents()
        {

        }

        protected virtual void OnViewCloseRequested(object sender, EventArgs e)
        {
            this.ViewCloseRequested(sender, e);
        }
    }
}
